import service from '../utils/request'

// 登录服务
export const login = (user) => {
    return service({
        url: '/sysUser/login',
        method: 'post',
        data: user
    })
}

// 获取用户信息
export const getUserInfo = () => {
    return service({
        url: '/sysUser/info',
        method: 'get'
    })
}

// 登出服务
export const logout = () => {
    return service({
        url: '/sysUser/logout',
        method: 'post'
    })
}

// 获取用户列表
export const getUserList = (params) => {
    return service({
        url: '/sysUser/list',
        method: 'get',
        params
    })
}

// 添加用户
export const addUser = (data) => {
    return service({
        url: '/sysUser/add',
        method: 'post',
        data
    })
}

// 更新用户
export const updateUser = (data) => {
    return service({
        url: '/sysUser/update',
        method: 'put',
        data
    })
}

// 删除用户
export const deleteUser = (userId) => {
    return service({
        url: `/sysUser/delete/${userId}`,
        method: 'delete'
    })
}

// 更新用户状态
export const updateUserStatus = (userId, status) => {
    return service({
        url: '/sysUser/updateStatus',
        method: 'put',
        data: { userId, status }
    })
}
